#include <iostream>
#include <thread>
#include <string>
#include <future>
#include <memory>

int add(int x,int y)
{
    std::cout<<"add"<<std::endl;
    return x + y;
}
int main()
{
    std::promise<int> pro;
    
    auto f = pro.get_future();

    std::thread tid([&pro](){
        int sum = add(1,2);
        pro.set_value(sum);
    });
    std::cout<<f.get()<<std::endl;
    tid.join();
    return 0;
}